<template>
	<view class="content">
		<view v-if="isShowConfirm" class="dialog" @click="isShowConfirm = false">
			<view class="dialog-content">
				<view class="dialog-image">
					<image src="../../static/confirm.png" mode="widthFix"></image>
				</view>
				<view class="dialog-text">恭喜您预约成功</view>
			</view>
		</view>

		<image src="../../static/appointment_banner.png" mode="widthFix"></image>
		<view class="from-item">
			<view class="from-item">楼盘名称</view>
			<view class="from-input"><input placeholder="请输入楼盘名称" /></view>
		</view>
		<view class="from-item">
			<view class="from-item">预约类型</view>
			<view class="from-input">
				<picker mode="selector" :range="array" :index="index" @change="bindPickerChange">
					<view>{{ array[index] }}</view>
				</picker>
				<image class="from-more" src="../../static/more.png" mode="widthFix"></image>
			</view>
		</view>
		<view class="from-item">
			<view class="from-item">户&emsp;&emsp;型</view>
			<view class="from-input element">
				<input placeholder="请输入户型" type="number" />
				<view class="from-unit">
					<view>(m²)</view>
				</view>
			</view>
		</view>
		<view class="from-item">
			<view class="from-item">姓&emsp;&emsp;名</view>
			<view class="from-input"><input placeholder="请输入姓名" /></view>
		</view>
		<view class="from-item">
			<view class="from-item">联系方式</view>
			<view class="from-input"><input placeholder="请输入联系方式" /></view>
		</view>
		<view class="from-item">
			<view class="from-item">微信号码</view>
			<view class="from-input"><input placeholder="请输入微信号码" /></view>
		</view>
		<view class="btn" hover-class="btn-hover" type="default" size="mini" @click="isShowConfirm = true">确定预约</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isShowConfirm: false,
				index: 1,
				array: ['验房', '微改报价', '设计', '拎包入住']
			};
		},
		methods: {
			bindPickerChange(e) {
				this.index = e.detail.value;
			}
		}
	};
</script>

<style lang="scss" scoped>
	.content {
		display: flex;
		flex-direction: column;

		.dialog {
			position: fixed;
			width: 100%;
			height: 100vh;
			background: rgba(0, 0, 0, 0.5);
			z-index: 999;

			.dialog-content {
			position: absolute;
			left: 0;
			top: 0;
			right: 0;
			bottom: 0;
			width: 400rpx;
			height: 228rpx;
			margin: auto;
			background: #ffffff;
			border-radius: 16rpx;
			display: flex;
			align-items: center;
			flex-direction: column;

				.dialog-image {
					width: 150rpx;
					height: 150rpx;
					margin-top: 20rpx;
				}

				.dialog-text {
					font-size: 50rpx;
				}
			}
		}

		.from-item {
			display: flex;
			align-items: center;
			box-sizing: border-box;
			margin-top: 40rpx;

			.from-item {
				margin: 0rpx 40rpx;
				font-size: 28rpx;
			}

			.from-input {
				position: relative;
				flex: 1;
				height: 60rpx;
				background-color: white;
				margin-right: 70rpx;
				border: 2rpx solid rgba(0, 0, 0, 0.1);
				border-radius: 10rpx;
				padding-left: 24rpx;
				padding-right: 24rpx;

				* {
					height: 100%;
					line-height: 60rpx;
					font-size: 28rpx;
				}

				.from-more {
					position: absolute;
					bottom: 0;
					top: 0;
					right: 30rpx;
					height: 20rpx;
					width: 20rpx;
					margin: auto;
				}

				.from-unit {
					position: absolute;
					bottom: 0;
					top: 0;
					right: 22rpx;
					color: #999999;
				}
			}

			.element {
				padding-right: 96rpx;
			}
		}
	}
</style>